<?php
$url = '?md=' . MvcReg::$_moduleName . '&cl=' . MvcReg::$_controllerName . '&at=' . str_replace('add', '', MvcReg::$_actionName) . 'update';
$distance = round($rsp_list['distance']/1000,2);
$sty = '';
if($distance >= 7){
    $sty = 'style="color:red"';
}
?>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <?php include_once MvcReg::$_moduleName . '/views/layout/head.php'; ?>
    <style>
        .modal-dialog{width:1000px;}
    </style>
</head>
<body>
<?php include_once MvcReg::$_moduleName . '/views/layout/woody-prompt.php'; ?>
<?php include_once MvcReg::$_moduleName . '/views/layout/header.php'; ?>
<div id="main">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-2">
                <?php include_once MvcReg::$_moduleName . '/views/layout/left_menu.php'; ?>
            </div>
            <div class="col-md-10">
                <div class="right-content">
                    <a href="?md=manage&cl=order&at=orderlist&page=<?php echo $page?>"  class="btn btn-white btn-xs pull-right goback floatright">返回上一级</a>
                    <h3>
                        <ol class="breadcrumb"><li><a href="?md=manage&cl=order&at=orderlist&page=<?php echo $page?>"><i class="fa fa-dashboard"></i><?php echo $menu["breadcrumb_current"]?></a><li class="active">查看</li></li></ol>
                    </h3>
                    <div class="col-sm-12">
                        <div class="wrapper wrapper-content animated fadeInUp">
                            <div class="ibox">
                                <div class="ibox-content">
                                    <div class="row">
                                        <div class="col-sm-10">
                                            <dt>门店信息</dt>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <dl class="dl-horizontal">
                                                <dt>门店编号：</dt>
                                                <dd><?php echo $shop_info['store_id']?></dd>
                                                <dt>门店名称：</dt>
                                                <dd><?php echo $shop_info['storename']?></dd>
                                                <dt>公司名称：</dt>
                                                <dd><?php echo $company_info[$shop_info['company_id']]['name']?></a>
                                                </dd>
                                            </dl>
                                        </div>
                                        <div class="col-sm-6" id="cluster_info">
                                            <dl class="dl-horizontal">
                                                <dt>门店电话：</dt>
                                                <dd><?php echo $shop_info['tel']?></dd>
                                                <dt>地址信息：</dt>
                                                <dd><?php echo $shop_info['front_province'] .$shop_info['front_city'].$shop_info['front_area'].$shop_info['address']?></dd>
                                            </dl>
                                        </div>
                                    </div>
                                    <hr/>
                                    <div class="row">
                                        <div class="col-sm-10">
                                            <dt>提货信息</dt>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <dl class="dl-horizontal">
                                                <dt>预计提货时间：</dt>
                                                <dd><?php echo empty($rsp_list['express'])?$rsp_list['delivery_time']:$rsp_list['express'][0]['shop_pickup_time']?></dd>
                                                <dt>订货人：</dt>
                                                <dd><?php echo $rsp_list['buyer']?></dd>
                                                <dt>收货人：</dt>
                                                <dd><?php echo $rsp_list['receiver']?></a>
                                                </dd>
                                                <dt>收货地址：</dt>
						                        <dd><?php echo $rsp_list['receiver_address']?></dd>
                                            </dl>
                                        </div>
                                        <div class="col-sm-6" id="cluster_info">
                                            <dl class="dl-horizontal">
                                                <dt>预计取货时间：</dt>
                                                <dd><?php echo empty($rsp_list['express'])?$rsp_list['delivery_time']:$rsp_list['express'][0]['shop_pickup_time']?></dd>
                                                <dt>收货人手机：</dt>
                                                <dd><?php echo $rsp_list['receiver_tel']?></dd>
                                                <dt>经度：</dt>
                                                <dd><?php echo $rsp_list['lng']?></dd>
                                                <dt>纬度：</dt>
                                                <dd><?php echo $rsp_list['lat']?></dd>
                                            </dl>
                                        </div>
                                    </div>
                                    <hr/>
                                    <div class="row">
                                        <div class="col-sm-10">
                                            <dt>订单信息</dt>
                                        </div>
                                    </div>
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <dl class="dl-horizontal">
                                                <dt>订单来源：</dt>
                                                <dd><?php echo $rsp_list['source']?></dd>
                                                <dt>渠道运费：</dt>
                                                <dd><?php echo $rsp_list['pos_fee']?> </dd>
                                                <dt>预估公里数：</dt>
                                                <dd <?php echo $sty;?>><?php echo $distance;?></dd>
                                                <dt>订单清单：</dt><br/>
                                                <?php foreach($rsp_list['product'] as $val){
                                                    echo '    <dd style="width: 85%;">
                                                                    <div><span><div style="width: 45%;float: left">' . $val['product_name'] . '</div><div style=" width: 15%;float: left;margin-left: 2%">' . $val['amount'] . '元</div><div style="width: 10%;float: left;margin-left: 2%">' . $val['qty'] . '个</div></span></div>
                                                                </dd>';

                                                }?>
                                                <br/>

                                                <dt>下单时间：</dt>
                                                <dd><?php echo $rsp_list['order_time']?><dd>
                                                <dt>生日蜡烛：</dt>
                                                <dd><?php echo $rsp_list['birthday_candles']?></dd>
                                                <dt>买家备注：</dt>
                                                <dd><?php echo $rsp_list['customre_memo']?></dd>

                                            </dl>
                                        </div>
                                        <div class="col-sm-6" id="cluster_info">
                                            <dl class="dl-horizontal">
                                                <dt>配货单号：</dt>
                                                <dd><?php echo $rsp_list['ph_no']?></dd>
                                                <dt>订单编号：</dt>
						                        <dd><?php echo $rsp_list['order_no']?></dd>
                                                <dt>实际支付：</dt>
                                                <dd><?php echo $rsp_list['actual_pay']?> 元</dd>
                                                <dt>卖家备注：</dt>
                                                <dd><?php echo $rsp_list['seller_remarks']?></dd>
                                                <dt>指派备注：</dt>
                                                <dd><?php echo $rsp_list['shop_express_remark']?></dd>
                                                <dt>配送人员：</dt>
                                                <dd><?php echo $rsp_list['express_courier']?></dd>
                                                <dt>配送人员联系电话：</dt>
                                                <dd><?php echo $rsp_list['express_mobile']?></dd>
                                                <dt>配送费：</dt>
                                                <dd><?php echo $rsp_list['express_fee']?></dd>
                                                <dt>配送方式：</dt>
                                                <dd><?php echo Data::$_express_type[$rsp_list['express_type']]?></dd>
                                                <dt>配送状态：</dt>
                                                <dd><?php echo Data::$_order_status[$rsp_list['status']]?></dd>
                                                <dt>配送小费：</dt>
                                                <dd><?php echo $rsp_list['tip']?></dd>
                                                <dt>配送小费备注：</dt>
                                                <dd><?php echo $rsp_list['tip_remark']?></dd>
                                            </dl>
                                        </div>
                                    </div>
                                    <hr/>
                                    <?php if((empty($rsp_list['express'][0])) || $rsp_list['status'] == 100){$display = 'style="display:none"';}else{
                                        $display = '';
                                    }?>
                                    <div class="row" <?php echo $display ?>>
                                        <div class="col-sm-10" >
                                            <dt>配送记录</dt>
                                        </div>
                                    </div>
                                    <div class="row" <?php echo $display ?>>
                                        <div class="col-sm-12">
                                            <dl class="dl-horizontal">
                                                <div class="table-responsive">
                                                    <table class="table table-hover">
                                                        <thead>
                                                        <tr class="info">
                                                            <th>配送方</th>
                                                            <th>预计送达时间</th>
                                                            <th>预计取货时间</th>
                                                            <th>商品重量</th>
                                                            <th>配送方订单号(运费)</th>
                                                            <th>配送员信息(手机号)</th>
                                                            <th>配送地址</th>
                                                            <th>配送状态</th>
                                                            <th>操作时间</th>
                                                            <th>操作</th>
                                                        </tr>
                                                        </thead>
                                                        <tbody>
                                                        <?php
                                                        foreach($rsp_list['express'] as $exval){
                                                            if($exval['express_type'] == 'self'){
                                                                $express_no = $exval['shop_express_no'];
                                                            }else {
                                                                $express_no = $exval['express_order_no'];
                                                            }
                                                            $isdeleted = $exval['isdeleted']==1?'<label class="red">(订单删除)</label>':'';
                                                            echo '<tr>
                                                                <td>'. Data::$_express_type[$exval['express_type']] .'</td>
                                                                <td> '.$exval['shop_delivery_time'].'</td>
                                                                <td>'. $exval['shop_pickup_tim'].'</td>
                                                                <td>'.$exval['shop_goods_weight'].'</td>
                                                                <td>'. $express_no.(empty($exval['express_fee'])?'':'('.$exval['express_fee'].')') .'</td>
                                                                <td>'. (empty($exval['express_mobile'])?'':'('.$exval['express_mobile'].')') .'</td>
                                                                <td>'. (empty($exval['shop_delivery_address'])?'无修改':'('.$exval['shop_delivery_address'].')') .'</td>
                                                                
                                                                <td>'.Data::$_express_status[$exval["status"]].$isdeleted.'</td>
                                                                <td>'.substr($exval["updatedt"],0,16).'</td>
                                                                    <td><button type="button" class="btn btn-primary" data-toggle="modal"
                                                                                data-target="#show_data"
                                                                                onclick="show_data('.$exval['id'].')">
                                                                            查看详细信息
                                                                        </button>
                                                                    </td>
                                                            </tr>';
                                                        }?>

                                                        </tbody>
                                                    </table>
                                                </div>
                                            </dl>
                                        </div>
                                    </div>


                                    <?php if (!empty($rsp_list['shop_delivery_address'])){?>
                                        <br>
                                        <h4>收货信息修改记录</h4>
                                        <div class="table-responsive">
                                            <table class="table table-hover">
                                                <thead>
                                                <tr class="info">
                                                    <th>序号</th>
                                                    <th>原地址</th>
                                                    <th>修改后地址</th>
                                                    <th>操作时间</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <?php foreach ($rsp_list['shop_delivery_address'] as $k=>$sda){?>
                                                    <tr>
                                                        <td>
                                                            <?php echo $k+1 ?>
                                                        </td>
                                                        <td>
                                                            收货人：<?php echo $sda["old_receiver_name"] ?> <br/>
                                                            收货人电话： <?php echo $sda["old_receiver_tel"] ?><br/>
                                                            收货人地址：<?php echo $sda["old_receiver_address"] ?>
                                                        </td>
                                                        <td>
                                                            收货人：<?php echo $sda["receiver_name"] ?> <br/>
                                                            收货人电话：<?php echo $sda["receiver_tel"] ?><br/>
                                                            收货人地址：<?php echo $sda["receiver_address"] ?>
                                                        </td>
                                                        <td><?php echo $sda["createdt"] ?></td>
                                                    </tr>
                                                <?php }  ?>
                                                </tbody>
                                            </table>
                                        </div>
                                    <?php }?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php include_once MvcReg::$_moduleName . '/views/layout/footer.php'; ?>
    <?php include_once MvcReg::$_moduleName . '/views/order/order_delivery_infoView.php'; ?>
</body>
</html>
<script>

    $("#show_data").on("hidden.bs.modal", function() {
        $(this).removeData("bs.modal");
        location.href = location.href;
    });

</script>
